/*
 * @Author: 颜礼田 2564217790@qq.com
 * @Date: 2024-08-26 17:13:13
 * @LastEditors: MrDotYan 2564217790@qq.com
 * @LastEditTime: 2024-09-24 16:18:12
 * @FilePath: /turo-repo-enterprise/apps/fuck-enterprise-admin/src/stores/modules/notice.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { PORT1 } from "@/api/config/servicePort";
import { Counter, Id, ReqPage } from "@/api/interface";
import { NoticeSchema } from "@/schema";
import http from "../";

export function fetchNoticeList(data: ReqPage) {
  return http.post<NoticeSchema>(`${PORT1}/notice/list`, data);
}

export function saveNotice(data: NoticeSchema) {
  return http.post<NoticeSchema>(`${PORT1}/notice/save`, data);
}

export function removeNotice(params: Id) {
  return http.delete<NoticeSchema>(`${PORT1}/notice/remove`, params);
}

export function editNotice(params: Id, data: NoticeSchema) {
  return http.put<NoticeSchema>(`${PORT1}/notice/edit`, data, { params });
}

export function fetchNoticeInfo(params: Id) {
  return http.get<NoticeSchema>(`${PORT1}/notice/info`, params);
}

export function changeNoticeIsOff(params: Id) {
  return http.put<NoticeSchema>(`${PORT1}/notice/isOff`, {}, { params });
}

export function fetchLastedList(params: Counter) {
  return http.get<Array<NoticeSchema>>(`${PORT1}/notice/lasted_list`, params);
}
